#ifndef __DEFER_H__
#define __DEFER_H__

#include <functional>

namespace minic {

std::function<void()> DerferFunc;
/**
 * @brief defer 用于延时处理，用于统一进行资源释放.
 */
class Defer {
public:
    Defer(std::function<void()> func) {
        DerferFunc = func;
    }

    ~Defer() {
        DerferFunc();
    }
};

}

#endif